import request from "@/utils/request";
export const apis = {
  add: (data) => {
    return request({
      url: "/preventionRiskOught/create",
      method: "post",
      data: data,
    });
  },
  query: (params) => {
    return request({
      url: "/preventionRiskOught/list",
      method: "get",
      params,
    });
  },
  del: (row) => {
    return request({
      url: "/preventionRiskOught/delete",
      method: "get",
      params: {
        id: row.id,
      },
    });
  },
  update: (data) => {
    return request({
      url: "/preventionRiskOught/update",
      method: "post",
      data: data,
    });
  },
  url: "/preventionRiskOught",
  exportPdf: (id, filename) => {
    return request({
      method: "get",
      responseType: "blob",
      url: "/preventionRiskOught/export/pdf/" + id,
      // params: { id },
    }).then((res) => {
      const blob = new Blob([res]);
      const link = document.createElement("a");
      link.href = window.URL.createObjectURL(blob);
      link.download = `${filename}.pdf`;
      link.click();
      link.remove();
    });
  },
};
